package com.ztsjglxt.utils;

import java.util.List;
import java.util.Map;

public class Laypage {
	public Laypage() {

	}

	public Laypage(List<Map<String, Object>> list, int records,PageUtil table) {
		this.setList(list);
		this.setCurr(table.getPage());
		this.setTotal(records);
		this.setPages(records, table.getRows());

		// page.setList(list);
		// page.setCurr(table.getPage());
		// page.setTotal(records);
		// page.setPages(records, table.getRows());
	}

	private int curr;// 当前页码
	private int pages;// 总的页数
	private int total;// 总的条数
	private List<Map<String, Object>> list;

	public int getCurr() {
		return curr;
	}

	public void setCurr(int curr) {
		this.curr = curr;
	}

	public int getPages() {
		return pages;
	}

	public void setPages(int records, int rows) {
		int pages = 1;
		if (records == 0) {
			pages = 1;
		} else if (records % rows == 0) {
			pages = (records / rows);
		} else {
			pages = (records / rows) + 1;
		}
		this.pages = pages;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public List<Map<String, Object>> getList() {
		return list;
	}

	public void setList(List<Map<String, Object>> list) {
		this.list = list;
	}

}
